<!--##########################################
    ##### Autor: Yngrid Coello           #####
    ##### Correo: y-c-@hotmail.com       #####
    ##### Ult. Modif: 26/10/2011         #####
    ##### Pasantias de Grado - USB       #####
    ##### Realización del Sistema: 0Bs   #####
    ##########################################-->

<?php use_stylesheet('tablas.css') ?>
<h1>Listado de Tipos de Combustibles</h1>

<table>
  <thead class="mostrar_encabezados">
    <tr>
      <th>Nombre</th>
      <th>Descripcion</th>
      <?php if(sfContext::getInstance()->getUser()->hasCredential(array('administrador','administradorc'),false)){?>
        <th>Editar</th>
      <?php }?>
      <?php if(sfContext::getInstance()->getUser()->hasCredential(array('administrador','administradorc'),false)){?>
        <th>Eliminar</th>
      <?php }?>
    </tr>
  </thead>
    <?php if ($pager->getLastPage() > 1):?> 
            <?php if(sfContext::getInstance()->getUser()->hasCredential(array('administrador','administradorc'),false)){?>
                <div style="margin-left:330px;height:20px;">
                    &nbsp;<b>Pag <?php echo $pager->getPage() ?></b>
                </div>
            <?php }elseif(sfContext::getInstance()->getUser()->hasCredential(array('analista'),false)){?>
                <div style="margin-left:270px;height:20px;">
                    &nbsp;<b>Pag <?php echo $pager->getPage() ?></b>
                </div>
            <?php }elseif(sfContext::getInstance()->getUser()->hasCredential(array('consultor'),false)){?>
                <div style="margin-left:215px;height:20px;">
                    &nbsp;<b>Pag <?php echo $pager->getPage() ?></b>
                </div>
            <?php }?>
	<?php endif ?>
  <tbody class="mostrar">
    <?php foreach ($pager->getResults() as $TipoComb): ?>
    <tr>
      <td><?php echo $TipoComb->getNombre() ?></td>
      <td><?php echo $TipoComb->getDescripcion() ?></td>
      <?php if(sfContext::getInstance()->getUser()->hasCredential(array('administrador','administradorc'),false)){?>
        <td class="imagen"><a href="<?php echo url_for('tipoComb/edit?nombre='.$TipoComb->getNombre()) ?>"><img src="/images/editar.png" ></a></td>
      <?php }?>
      <?php if(sfContext::getInstance()->getUser()->hasCredential(array('administrador','administradorc'),false)){?>
        <td class="imagen"><?php echo link_to('<img src="/images/eliminar.png">', 'tipoComb/delete?nombre='.$TipoComb->getNombre(), array('method' => 'delete', 'confirm' => 'Esta seguro que desea eliminar el tipo de combustible '.$TipoComb->getNombre().'?')) ?></td>
      <?php }?>    
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
<div id="nuevoVuelo" class="inline">
    <?php if(sfContext::getInstance()->getUser()->hasCredential(array('administrador','administradorc'),false)){?>
        <a href="<?php echo url_for('tipoComb/new') ?>">Agregar Tipo de Combustible</a>
    <?php }?>
</div>
<div class="inline" id="paginacion" style="margin-left:25px;">
	<?php if ($pager->haveToPaginate()): ?>
	<a href="<?php echo url_for('tipoComb/index?page='.$pager->getFirstPage()) ?>"><img src="/images/flecha.png"></a>
	<?php $links = $pager->getLinks();
	foreach ($links as $page): ?>
	<?php ($page == $pager->getPage()) ?>
	<a href="<?php echo url_for('tipoComb/index?page='.$page) ?>"><?php echo $page ?></a>
	<?php if ($page != $pager->getCurrentMaxLink()): ?> <?php endif ?>
	<?php endforeach ?> 
	<a href="<?php echo url_for('tipoComb/index?page='.$pager->getLastPage()) ?>"><img src="/images/flecha1.png"></a>
	<?php endif ?>
</div>